<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<!-- 上传部分 -->
<link href="${path}/static/uploadify/uploadify.css" rel="stylesheet" type="text/css">
<script type="text/javascript"  src="${path}/static/uploadify/jquery.uploadify.js"></script>

<script type="text/javascript">
    $(function() {
        $("#photo_upload").uploadify({
            'height'        : 27,
            'width'         : 80,
            'buttonText'    : '添加商品图片',
            'swf': '${path}/static/uploadify/uploadify.swf',
            'uploader': 'appGoodsManage/uploadPhoto',
            'cancelImg': '${path}/static/uploadify/uploadify-cancel.png',
            'auto'          : true, //设置auto为true，当文件被添加至上传队列时，将会自动上传。
            'fileSizeLimit' : '512000KB', // 50M
            'fileTypeExts'  : '*.jpg;*.jpeg;*.png;*.unity3d;*.gif;*.ps;*.bmp;',
            'uploadLimit' : 100,
            'onUploadStart' : function(file) {

            },
            'onUploadSuccess':function(file, data, response){
                data = $.parseJSON( data );
                if(data.success){
                    $("#photo").val(data.msg);
                }else{
                    $("#photo").val("");
                }
            },
            'onUploadComplete':function(res){
            }
        });

        $('#appGoodsManageEditForm').form({
            url : '${path }/appGoodsManage/edit',
            onSubmit : function() {
                progressLoad();
                var isValid = $(this).form('validate');
                if (!isValid) {
                    progressClose();
                }
                return isValid;
            },
            success : function(result) {
                progressClose();
                result = $.parseJSON(result);
                if (result.success) {
                    parent.$.modalDialog.openner_dataGrid.datagrid('reload');
                    parent.$.modalDialog.handler.dialog('close');
                }
            }
        });
        $("#editGoodsStatus").val('${appGoodsManage.goodsStatus}');
        $("#editGoodsStopFlag").val('${appGoodsManage.goodsStopFlag}');
    });


</script>
<div style="padding: 3px;">
    <form id="appGoodsManageEditForm" method="post">
        <table class="grid">
            <tr>
                <td>编码</td>
                <td>
                    <input name="id" type="hidden" value="${appGoodsManage.id}">
                    <input name="goodsCode" type="text" value="${appGoodsManage.goodsCode}" placeholder="请输入商品编码" class="easyui-validatebox" data-options="required:true">
                </td>
                <td>名称</td>
                <td>
                    <input name="goodsName" type="text" value="${appGoodsManage.goodsName}" placeholder="请输入商品名称" class="easyui-validatebox" data-options="required:true">
                </td>
            </tr>
            <tr>
                <td>重量</td>
                <td>
                    <input name="goodsWeight" type="text" value="${appGoodsManage.goodsWeight}" class="easyui-validatebox" data-options="required:true">
                </td>
                <td>规格</td>
                <td>
                    <input name="goodsSpec" type="text" value="${appGoodsManage.goodsSpec}"  class="easyui-validatebox" data-options="required:true">
                </td>
            </tr>
            <tr>
                <td>价格</td>
                <td>
                    <input name="goodsPrice" type="text" value="${appGoodsManage.goodsPrice}"  class="easyui-validatebox" data-options="required:true">
                </td>
                <td>库存</td>
                <td>${appGoodsManage.amount}</td>
            </tr>
            <tr>
                <td>状态</td>
                <td >
                    <select id="editGoodsStatus" name="goodsStatus" class="easyui-combobox" data-options="width:100,height:29,editable:false,panelHeight:'auto'">
                        <option value="0">下架</option>
                        <option value="1">上架</option>
                    </select>
                </td>
                <td>停售</td>
                <td>
                    <select id="editGoodsStopFlag" name="goodsStopFlag" class="easyui-combobox" data-options="width:100,height:29,editable:false,panelHeight:'auto'">
                        <option value="0">是</option>
                        <option value="1">否</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>图片</td>
                <td colspan="3">
                    <input id="photo_up" name="photo_up" type="file" multiple="true">
                    <input type="hidden" name="image1" id="image1" value="${appGoodsManage.image1}" data-options="required:ture">
                </td>
            </tr>
            <tr>
                <td>所属分类</td>
                <td><select id="appGoodsManageEditTypeId" name="appGoodsTypeId" style="width: 140px; height: 29px;" class="easyui-validatebox" ></select></td>
            </tr>
        </table>
    </form>
</div>